package http

import (
	"github.com/valyala/fasthttp"
	"github.com/json-iterator/go"
	"time"
)
type CommonResponse struct {
	Code string    `json:"code"`
	ErrorNo int `json:"error_no"`
	Msg  string `json:"msg"`

}
type Response struct{
	Code int
	Body string
	Err  error
	Dur  time.Duration
}
func ServeJson(ctx *fasthttp.RequestCtx,code int,message string){
	ctx.Response.Header.Add("Content-Type","application/json; charset=utf-8")
	res,_ := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(&CommonResponse{
		"fail",code,message,
	})
	ctx.Write(res)
}